<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title data-i18n="resources.title_themeGraph"></title>
    <script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? window.server : "https://iserver.supermap.io";
    var map, themeService, themeGraph, themeParameters, themeLayer,
        mapUrl = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图",
        url = host + "/iserver/services/map-jingjin/rest/maps/京津地区人口分布图_专题图";
    map = L.map('map', {
        crs: L.CRS.EPSG4326,
        center: [40, 117],
        maxZoom: 18,
        zoom: 6
    });
    new L.supermap.TiledMapLayer(mapUrl, {noWrap: true}).addTo(map);
    createTheme();

    function createTheme() {
        themeService = new L.supermap.ThemeService(url);
        themeGraph = new L.supermap.ThemeGraph({
            items: [
                new L.supermap.ThemeGraphItem({
                    caption: "1992-1995人口增长率",
                    graphExpression: "Pop_Rate95",
                    uniformStyle: new L.supermap.ServerStyle({
                        fillForeColor: new L.supermap.ServerColor(92, 73, 234),
                        lineWidth: 0.1
                    })
                }),
                new L.supermap.ThemeGraphItem({
                    caption: "1995-1999人口增长率",
                    graphExpression: "Pop_Rate99",
                    uniformStyle: new L.supermap.ServerStyle({
                        fillForeColor: new L.supermap.ServerColor(211, 111, 240),
                        lineWidth: 0.1
                    })
                })
            ],
            barWidth: 0.03,
            graduatedMode: L.supermap.GraduatedMode.SQUAREROOT,
            graphAxes: new L.supermap.ThemeGraphAxes({
                axesDisplayed: true
            }),
            graphSize: new L.supermap.ThemeGraphSize({
                maxGraphSize: 1,
                minGraphSize: 0.35
            }),
            graphText: new L.supermap.ThemeGraphText({
                graphTextDisplayed: true,
                graphTextFormat: L.supermap.ThemeGraphTextFormat.VALUE,
                graphTextStyle: new L.supermap.ServerTextStyle({
                    sizeFixed: true,
                    fontHeight: 9,
                    fontWidth: 5
                })
            }),
            graphType: L.supermap.ThemeGraphType.BAR3D
        });
        themeParameters = new L.supermap.ThemeParameters({
            themes: [themeGraph],
            dataSourceNames: ["Jingjin"],
            datasetNames: ["BaseMap_R"]
        });
        themeService.getThemeInfo(themeParameters).then(function (serviceResult) {
            var result = serviceResult.result;
            if (result && result.newResourceID) {
                themeLayer = new L.supermap.TiledMapLayer(url, {
                    noWrap: true,
                    cacheEnabled: false,
                    transparent: true,
                    layersID: result.newResourceID
                }).addTo(map);
            }
        });
    }
</script>
</body>
</html>